package cn.big.bigd.biocode.util;

import com.neovisionaries.i18n.CountryCode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * @ClassName: CountryUtil
 * @Description: TODO
 * @Author: FanWang
 * @CreateDate: 2018/1/22 下午4:10
 * @Version: 1.0
 * @Copyright: Copyright (c) 2018/1/22
 **/
public class CountryUtil {
 private static final Logger logger = LoggerFactory.getLogger(CountryUtil.class);


    public static  List<Country> countryList()  {
        List<Country> countryList =new ArrayList<>();
        Country c;
        for (CountryCode code : CountryCode.values())
        {
            if(!code.getAlpha2().equals("UNDEFINED")){
                c =new Country();
                c.setCode(code.getAlpha2());
                c.setName(code.getName());
                countryList.add(c);
            }

        }
        Collections.sort(countryList);
        return countryList;




       /* for (CurrencyCode code : CurrencyCode.values())
        {
            System.out.format("[%s] %03d %s\n", code, code.getNumeric(), code.getName());
        }*/

    }

    /*public static void main(String[] args) {
        CountryUtil.countryList();

    }*/




}


